package com.cd.service.news.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cd.bean.News;
import com.cd.bean.SearchCondition;
import com.cd.dao.NewsMapper;
import com.cd.dao.SearchMapper;
import com.cd.service.news.NewsService;

/**
 *新闻动态
 *@Author zhk
 *@Date 2017-12-19
 **/
@Service("newsService")
public class NewsServiceImpl implements NewsService {

	@Autowired
	NewsMapper newsMapper;
	
	
	@SuppressWarnings("unchecked")
	@Override
	public void save(News news) throws Exception {
		newsMapper.save(news);
	}

	@Override
	public void delete(Integer id) throws Exception {
		newsMapper.delete(id);
	}

	@SuppressWarnings("unchecked")
	@Override
	public void edit(News news) throws Exception {
		newsMapper.update(news);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<News> listAll() throws Exception {
		
		return newsMapper.queryByList();
	}

	@Override
	public News findById(Integer id) throws Exception {
		return newsMapper.query(id);
	}

	@Override
	public void deleteAll() throws Exception {
		
	}

	@Override
	public Integer size() throws Exception {
		return newsMapper.getCount();
	}

	@Override
	public List<News> listLimit() throws Exception {
		return newsMapper.list();
	}


	@Override
	public Integer deleteBatch(Integer[] array) {
		// TODO Auto-generated method stub
		return newsMapper.deleteBatch(array);
		
	}

	
	
}
